<?php $this->renderPartial('/admin/menu/settings');?>
<h4><?php echo Yii::t('helpdesk','Document Folders'); ?></h4>
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message){
	echo '<div class="'.$key.'"><p>'.$message."</p></div>\n";
}
?>
<form class="form-horizontal" method="post">
<table style="width: auto;" class="table table-striped table-bordered table-nonfluid table-condensed">
<tbody>
	<tr><td>
		<?php echo Yii::t('helpdesk','Parent'); ?>:
    	<select id="parent" name="parent">
            <option value="">-- <?php echo Yii::t('helpdesk','None'); ?> --</option>
            <?php foreach($arrFolders as $R): ?>
            <option value="<?php echo $R['category_id']; ?>" <?php if( isset($folder['category_parent']) && $R['category_id'] == $folder['category_parent']):?>selected=""<?php endif; ?>> <?php for($i=0; $i<$R['category_level']; $i++): echo '&nbsp;&nbsp;&nbsp;&nbsp;'; endfor;?> <?php echo $R['category_name']; ?></option>
            <?php endforeach; ?>
        </select>
    </td></tr>
	<tr><td><?php echo Yii::t('helpdesk','Name'); ?>: <input type="text" maxlength="30" name="category_name"  required="" value="<?php echo isset($folder['category_name'])?$folder['category_name']:null; ?>">&nbsp;<input type="submit" class="btn btn-primary" value="<?php echo !empty($intId)?Yii::t('helpdesk','Update'):Yii::t('helpdesk','Add'); ?>"></td></tr>
</tbody>
</table>
</form>

<table style="width: 100%;" class="table table-striped table-bordered table-nonfluid">
<tbody>
	<tr>
        <th><?php echo Yii::t('helpdesk','Folder Name'); ?></th>
        <th width="80px"><?php echo Yii::t('helpdesk','Actions'); ?></th>
	</tr>
    <?php if(!empty($arrFolders)): ?>
    <?php foreach($arrFolders as $R): ?>
	<tr>
    	<td>
        	<?php if($R['category_level'] > 0): for($i=0; $i<$R['category_level']; $i++): echo '&nbsp;&nbsp;&nbsp;&nbsp;'; endfor; echo '|---'; endif; ?>
			<?php echo $R['category_name']; ?>
        </td>
        <td>
        	<a href="/admin/documentfolders/?id=<?php echo $R['category_id']; ?>"><i title="<?php echo Yii::t('helpdesk','Edit'); ?>" class="glyphicon glyphicon-edit"></i></a>
            &nbsp;
            <a onclick="return confirm('<?php echo Yii::t('helpdesk','Are you sure you want to delete?'); ?>')" href="/admin/documentfolders/?id=<?php echo $R['category_id']; ?>&act=delete"><i title="<?php echo Yii::t('helpdesk','Delete'); ?>" class="glyphicon glyphicon-remove-circle"></i></a>
        </td>
    </tr>
    <?php endforeach; ?>
    <?php else: ?>
    <tr>
    	<td colspan="2"><?php echo Yii::t('helpdesk','No data found'); ?></td>
    </tr>
    <?php endif; ?>   
</tbody></table>